<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html, body{
            margin: 0;
            padding: 0;
            user-select: none;
        }
        :root{
            --bg: #f0f0f0;
            --title: #333;
            --word: #999; 
        }
        .dark{
            --bg: #292929;
            --title: #999;
            --word: #666; 
        }
        .bg{
            background: var(--bg);
            padding: 20px;
        }
        .t1{
            color: var(--title);
            margin-bottom: 20px;
        }
        .t2{
            color: var(--word);
            margin-bottom: 20px;
        }
        .btn{
            margin-bottom: 40px;
            cursor: pointer;
            color: var(--title);
        }
        canvas{
            border: solid 1px var(--word);
        }
    </style>
</head>
<body>
    <div class="bg dark">
        <div class="t1">標題</div>
        <div class="t2">文字内容</div>
        <div class="btn" onclick="change()">切換</div>
        <canvas class="canvas"></canvas>
    </div>

    <script>
        function change(){
            var t = document.querySelector(".bg");
            t.classList.toggle("dark");
        }
    </script>
</body>
</html>